package com.yunyi.integration.action;

import com.yunyi.integration.service.PolymorphismAdapt;
import com.yunyi.integration.service.polymorphism.AbsPolymorphismService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
@RequestMapping("/polymorphism")
public class PolymorphismAdaptAction {
    @Autowired
    private PolymorphismAdapt polymorphismAdapt;

    @GetMapping("testMode2")
    public void testPolymorphism() {
        Map<String, AbsPolymorphismService> polymorphismServiceMap = polymorphismAdapt.getPolymorphismServiceMap();
        AbsPolymorphismService polymorphismServiceOne = polymorphismServiceMap.get("polymorphismServiceOne");
        polymorphismServiceOne.doSomething("张三");
        AbsPolymorphismService polymorphismServiceTwo = polymorphismServiceMap.get("polymorphismServiceTwo");
        polymorphismServiceTwo.doSomething("李四");
        System.out.println("111111");
    }

}
